package com.cet.designpatterns.builder.improvement;

/**
 * @program: algorithm
 * @description: 指挥者，指定建造流程
 * @author: 陈恩涛
 * @create: 2021-09-07 09:31
 **/
public class Director {

    private HouseBuilder builder;

    //构造器传入
    public Director(HouseBuilder builder) {
        this.builder = builder;
    }

    //setter传入
    public void setBuilder(HouseBuilder builder) {
        this.builder = builder;
    }

    //如何处理建造房子的流程，交给指挥者
    public House constructHouse() {
        return builder.buildBasic()
                .buildWall()
                .buildRoof()
                .build();
    }
}
